(Pick attack type based on four different levels of charging.  If firing
 Bazooka, either decrement ammo count, or switch to Bazooka bludgeon attack
 if the chosen ammo is gone.)

(Note: this function is identical across all European versions [English, French,
 German, Spanish], except the French and Spanish instead have
 "D0/8344: BF 02 00 C3  LDA $C30002,X" )

D0/82D8: A4 4C        LDY $4C
D0/82DA: BE 60 00     LDX $0060,Y   (get pointer to potential attacker's stats)
D0/82DD: B9 2E 00     LDA $002E,Y   (get potential attacker's current charge value.
                                     this is obvious enough on the boy and dog with
                                     their gauges, though i'm not sure how it works
                                     with enemies.)
D0/82E0: C9 00 04     CMP #$0400
D0/82E3: 90 2E        BCC $8313     (branch if meter < 100%)
D0/82E5: C9 00 08     CMP #$0800
D0/82E8: 90 23        BCC $830D     (branch if meter at least 100%, but not yet
                                     a full thin bar)
D0/82EA: C9 00 0C     CMP #$0C00
D0/82ED: 90 0F        BCC $82FE     (branch if at least a full thin bar, but not
                                     yet a full thick bar)
D0/82EF: B9 14 00     LDA $0014,Y
D0/82F2: 09 00 02     ORA #$0200
D0/82F5: 99 14 00     STA $0014,Y    (???)
D0/82F8: BF 3E 00 8E  LDA $8E003E,X  (attack to do if charged to level 3)
D0/82FC: 80 19        BRA $8317
D0/82FE: B9 14 00     LDA $0014,Y
D0/8301: 09 00 02     ORA #$0200
D0/8304: 99 14 00     STA $0014,Y    (i just said i don't know what it is! :P
                                      but i do know a pattern when i see one...)
D0/8307: BF 3C 00 8E  LDA $8E003C,X  (attack to do if charged to level 2)
D0/830B: 80 0A        BRA $8317
D0/830D: BF 3A 00 8E  LDA $8E003A,X  (attack to do if 100% charged)
D0/8311: 80 04        BRA $8317
D0/8313: BF 38 00 8E  LDA $8E0038,X  (attack to do if < 100% charged)
D0/8317: F0 45        BEQ $835E      (if the attack is null, just exit.  probably
                                      just a possibility for enemies.)
D0/8319: C9 3A 48     CMP #$483A
D0/831C: B0 25        BCS $8343      (branch if attack type >= 483Ah)
D0/831E: C9 0A 48     CMP #$480A
D0/8321: 90 20        BCC $8343      (branch if attack type < 480Ah)

                                     (attack types seem to be spaced 10h apart,
                                      so the above is effectively branching if the
                                      attack type isn't 480Ah [Thunder Ball shot],
                                      481Ah [Particle Bomb shot], or 482Ah
                                      [Cryo-Blast shot].)

D0/8323: 48           PHA            (save attack type)
D0/8324: AD 49 23     LDA $2349      (get ammunition type of currently chosen
                                      shell.  0 = Thunder Ball, 2 = Particle Bomb,
                                      4 = Cryo Blast.)
D0/8327: 29 FE 00     AND #$00FE
D0/832A: 4A           LSR
D0/832B: AA           TAX            (now it's 0 = Thunder Ball,
                                      1 = Particle Bomb, 2 = Cryo Blast)
D0/832C: BD 45 23     LDA $2345,X
D0/832F: 29 FF 00     AND #$00FF     (get ammunition count)
D0/8332: D0 06        BNE $833A      (branch if we have some left)
D0/8334: 68           PLA
D0/8335: A9 2E 45     LDA #$452E
D0/8338: 80 09        BRA $8343      (if there's none left, use the bazooka
                                      bludgeon attack instead.  this should
                                      match whatever value was in $8E0038,X
                                      above.)
D0/833A: E2 20        SEP #$20
D0/833C: 3A           DEC
D0/833D: 9D 45 23     STA $2345,X    (decrement ammunition count)
D0/8340: C2 30        REP #$30
D0/8342: 68           PLA            (restore attack type)
D0/8343: AA           TAX
D0/8344: BF 02 00 C4  LDA $C40002,X
D0/8348: 89 00 40     BIT #$4000
D0/834B: F0 0E        BEQ $835B
D0/834D: 86 12        STX $12
D0/834F: BE 22 00     LDX $0022,Y
D0/8352: BF 5B 81 90  LDA $90815B,X
D0/8356: 99 22 00     STA $0022,Y
D0/8359: A6 12        LDX $12
D0/835B: 4C 1B 81     JMP $811B
D0/835E: 6B           RTL

